const net = require('net');
var server = net.createServer(function (socket){
        socket.write("朋友，你好.\n");
        socket.on('data',function(data){
            console.log("reciver data len",data.length+"\n","data is:",data.toString());
            socket.write("你好");
        });
        socket.on('end',function(data){
            console.log('连接断开');
        });
        socket.on('error',() => {
            console.log("error");
        })
    });
    server.listen(8000,function(){
        console.log('绑定服务器8000端口');
    });
